package aom.example.security.service;

import aom.example.security.domain.SysRoleEntity;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;
import java.util.Map;

/**
 * @author Xiongx
 * @version 1.0
 * @date 2021/6/11 14:46
 * @since JDK 1.8
 */
public interface SysRoleService extends IService<SysRoleEntity> {

    SysRoleEntity getSysRoleEntityByUserName(String userName);

    List<Map<String, Object>> selectRoleUserByUserId(String userid);

    boolean insertSysUserRole(String userid,String roleid);

    boolean insertSysRoleMenu(String roleId,String menuId);

    List<Map<String, Object>> selectUserNotRole(String uid);

    boolean deleteSysUserRoleById(String id);

    /**
     * 通过角色id列表，批量查询菜单
     * @param ids
     * @return
     */
    List<Map<String, Object>> selectRoleMenuList(List<String> ids);

    /**
     * 查询用户是否拥有此角色
     */
    Map<String, Object> selectByRoleIdMenuId(String roleId,String userId);

    IPage<Map<String, Object>> selectRoleMenu(String roleId,String keyword,Integer page,Integer size);

    /**
     * 解除授权(删除授权)
     */
    boolean deleteRoleMenuById(Integer id);

    /**
     * 查询用户授权角色分页
     * @param userId 用户id
     * @param keyword  关键字
     * @param pageNum  页码
     * @param pageSize  条数
     * @return
     */
    IPage<Map<String, Object>> pageRoleUser(String userId,String keyword,Integer pageNum,Integer pageSize);

    /**
     * 删除roleid 所有配置菜单相关的角色
     * @param roleId
     * @return
     */
    boolean deleteSysRoleMenuByRoleId(String roleId);
}
